<?php

/**
 * [PHPFOX_HEADER]
 */
defined('PHPFOX') or exit('NO DICE!');

/**
 * 
 * 
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Raymond Benc
 * @package 		Phpfox_Component
 * @version 		$Id: index.class.php 300 2009-03-20 13:01:54Z Raymond_Benc $
 */
class Takepicture_Component_Controller_Index extends Phpfox_Component {

    /**
     * Class process method wnich is used to execute this component.
     */
    public function process() {
        $aListSocials = Phpfox::getService('takepicture')->getByUser();
        
        $this->template()->setHeader('cache', array(
            'jquery.webcam.js' => 'module_takepicture',
            'zocial.css' => 'module_takepicture',
//            'webcam.js' => 'module_takepicture',
//            '<script type="text/javascript">$Behavior.webcam = function() {$Core.webcam.load();}</script>',
            'connectsocial.js' => 'module_connectsocial',
            '<script>$Behavior.connectSocial = function() {
                    $Core.connectSocial.init({
                        width: 800,
                        height: 600,
                        callback: function(data) {
                            console.log(data);
                        }
                    });

                    $(\'#js-connect-social li a\').click(function(event) {
                        event.preventDefault();
                        var url = $(this).attr(\'href\');
                        $Core.connectSocial.connect(url);
                    });
                }</script>'
        ))->assign(array(
            'aListSocials' => $aListSocials
        ));
    }

    /**
     * Garbage collector. Is executed after this class has completed
     * its job and the template has also been displayed.
     */
    public function clean() {
        
    }
}

?>